# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=zsh-history-substring-search
pkgver=1.1.0
pkgrel=1
pkgdesc="ZSH port of Fish history search (up arrow)"
arch=(any)
url="https://github.com/zsh-users/zsh-history-substring-search"
license=(BSD)
depends=(zsh)
source=($url/archive/v$pkgver/$pkgname-v$pkgver.tar.gz)
sha512sums=('267efc0960f6403b748e78734b43b8d997f05a2a2542520508e6ef028ef2e0a2c0805d24ae5ad4c30454742a08a7abf2e3baa591e60a660a0ca54aca0ad7175a')
b2sums=('c757f55be326c4aecdc05471940d66f70be596ca483f8c380bd0bc8e05920b70069200d5d865ee025d37cf079c0865d30eebc6952f9d7eaf4b7db71518e71a69')

prepare() {
  # extract license info: https://github.com/zsh-users/zsh-history-substring-search/issues/148
  sed -e 's/^# //g; s/^#//g' -ne 4,38p $pkgname-$pkgver/$pkgname.zsh > LICENSE
}

package() {
  install -vDm 644 $pkgname-$pkgver/$pkgname.zsh -t "$pkgdir/usr/share/zsh/plugins/$pkgname/"
  install -vDm 644 $pkgname-$pkgver/README.md -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
